// 导入请求工具函数
import { http } from '@/utils/http'
import {
  BannerItem,
  CategoryItem,
  HotMutliItem,
  NewItem,
  GuessData,
  GuessResult,
  RecommendData,
  Result,
} from '@/types/home'

/**
 * 首页 - 广告区域
 * @param distributionSite 广告区域展示位置 1 为首页(默认)，2 为商品分页
 * @requires false
 * @returns 无
 */
export const getHomeBanner = (distributionSite = 1) =>
  http<BannerItem[]>({ url: '/home/banner', method: 'GET', data: { distributionSite } })


/**
 * 首页 - 热门推荐
 * @returns 无
 */
export const getHomeHotMutli = () =>
  http<HotMutliItem[]>({ url: '/home/hot/mutli' })

/**
 * 首页 - 前台分类
 * @returns 无
 */
export const getHomeCategoryMutli = () =>
  http<CategoryItem[]>({ url: '/home/category/mutli' })

/**
 * 首页 - 新鲜好物
 * @param limit 默认值为 4，指定响应数据中商品的数量
 * @requires false
 * @returns 无
 */
export const getHomeNew = (limit = 4) =>
  http<NewItem[]>({ url: '/home/new' })

/**
 * 猜你喜欢
 * @param GuessResult
 * @returns
 */
export const getHomeGoodsGuessLike = (data: GuessData) =>
  http<GuessResult>({ url: '/home/goods/guessLike' })

/**
 * 特惠推荐
 * @param Result
 * @returns
 */
export const getHotPreference = (data: RecommendData) =>
  http<Result>({ url: '/hot/preference', method: 'GET', data })

/**
 * 推荐列表 - 获取爆款推荐数据
 * @param data 
 * @returns 
 */
export const getHotInVogue = (data: RecommendData) =>
  http<Result>({ url: '/hot/inVogue', method: 'GET', data })

/**
 * 通用推荐方法
 * @param url 
 * @param data 
 * @returns 
 */
export const getHotRecommend = (url: string, data: RecommendData) =>
  http<Result>({ url, method: 'GET', data })
